﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/**
* main camera controller
* @author lichenyi
* 2018-07-16 14:13:19
*/
public class MainCamera : MonoBehaviour
{
    public GameObject player; //player

    private Vector3 offset; //The distance between the player and the camera

    void Start()
    { 
        //Got the origin distance between the player and the camera
        offset = transform.position - player.transform.position;
    }

    void Update()
    {
        float moveHorizontal = Input.GetAxis("Horizontal"); //horizontal distance
        transform.Rotate(new Vector3 (0.0f, moveHorizontal, 0.0f));
        Vector3 move = new Vector3();
        if(moveHorizontal > 0)
            move = new Vector3(-moveHorizontal, 0.0f, moveHorizontal);
        else if (moveHorizontal < 0)
            move = new Vector3(moveHorizontal, 0.0f, moveHorizontal);
        //transform.position = player.transform.position + offset + move;
    }
}